Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/swift UI #67

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ConfusedVorlon
Copy link

This adds a simple wrapper for SwiftUI users

It's documented in the Readme - but essentially, it uses a standard fullscreenModal with a binding to an image or an array of images

struct ContentView: View {
    @State var image:UIImage?
    @State var showPicker:Bool = false

    var body: some View {
        VStack {
            if let image {
                Image(uiImage:image)
                    .resizable()
                    .frame(width:100,height:100)
            }

            Button("Pick a Photo") {
                showPicker = true
            }

        }
        .padding()
		//Note - use fullScreenCover rather than sheet
		//to avoid display issues on iPads
        .fullScreenCover(isPresented: $showPicker) {
            FMSwiftUIImagePicker(config: FMPhotoPickerConfig(),
                                 selectedImage: self.$image)
        }
    }
}

For multiple selection - just change the binding to [UIImage]

@squeaky-nose
Copy link

it would be nice to merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants